package net.io;

import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.channels.SocketChannel;

public class IntgenClient
{
	public static int DEFAULT_PORT = 1919;
	public static void main(String[] args)
	{
		try
		{
			SocketAddress address = new InetSocketAddress(DEFAULT_PORT);
			SocketChannel client = SocketChannel.open(address);
			ByteBuffer buffer = ByteBuffer.allocate(4);
			IntBuffer view = buffer.asIntBuffer();
			for (int i = 0; ; i++)
			{
				client.read(buffer);
				int actual = view.get();
				buffer.clear();
				view.rewind();
				if(actual!=i)
				{
					break;
				}
			}
		}
		catch (Exception e)
		{
		}
	}
}
